---
root: "/v5.1"
title: "Decodable"
description: "Swift documentation for 'Decodable'"
keywords: ""
layout: "default"
---

<div class="intro-declaration"><code class="language-swift">protocol Decodable</code></div><p>A type that can decode itself from an external representation.</p>
<table class="standard"><tr><th id="conforming-types">Conforming Types</th><td><code class="inherits">SIMD</code></td></tr></table><div class="discussion comment"></div><h3>Initializers</h3><div id="init_from-ac2c581668ee6074e8eee083d88ea873" class="declaration"><a class="toggle-link" href="#comment-init_from-ac2c581668ee6074e8eee083d88ea873">init init(from:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init_from-ac2c581668ee6074e8eee083d88ea873"><p>Creates a new instance by decoding from the given decoder.</p>
<p>This initializer throws an error if reading from the decoder fails, or
if the data read is corrupted or otherwise invalid.</p>
<ul>
<li>Parameter decoder: The decoder to read data from.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">init(from decoder: Decoder) throws</code></div></div>